// pages/order/details.js
const ORD = require("../../../interfaces/order")
const IFS = require("../../../interfaces/interface")
Page({

  /**
   * 页面的初始数据
   */
  data: {
    curOrder: 0,
      orderList: [
        {
            "front_cars": 17,
            "id": "27",
            "user_id": "48",
            "car_id": "6",
            "mode": "fast",
            "apply_kwh": 28,
            "charge_kwh": 38,
            "state": "cupidatat veniam esse",
            "charge_price": 54,
            "service_price": 53,
            "fee": 80,
            "create_time": "nisi quis ut sed amet",
            "dispatch_time": "ullamco sit",
            "charge_id": "94",
            "start_time": "veniam dolore sint",
            "finish_time": "sunt Lorem adipisicing",
            "number": 99
        },
        {
            "front_cars": 16,
            "id": "76",
            "user_id": "99",
            "car_id": "27",
            "mode": "slow",
            "apply_kwh": 73,
            "charge_kwh": 96,
            "state": "irure",
            "charge_price": 92,
            "service_price": 1,
            "fee": 39,
            "create_time": "mollit eiusmod deserunt",
            "dispatch_time": "Duis eiusmod",
            "charge_id": "86",
            "start_time": "Excepteur ad laboris",
            "finish_time": "sunt aute",
            "number": 90
        }
    ],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.setData({
      orderList: ORD.getAllOrders()
    })
    var newList = this.data.orderList
    newList.forEach(item => {
      item.fee.toFixed(2)
    });
    this.setData({
      orderList: newList
    })
    this.setData({
      curOrder: this.data.orderList[options.id]
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})